<template>
  <div class="common-content">
    <div class="header">
      <div class="title">创新团队</div>
      <div class="current-box ">
        <span class="current-text">当前位置</span>
        <span class="line"></span>
        <span class="">首页</span>
        <span class="line"></span>
        <span class="">创新团队</span>
      </div>
    </div>
    <ul class="video-list">
      <li @click="jumpToDetails(item)" v-for="item in  dataList" :key="item.id">
        <el-card body-style="padding:0" >
          <div class="cover">
            <div class="title-mask-box line-1">{{item.title}}创新团队</div>
            <img @error="errLoadImage(item)" :src="$TOOL.filterUrl(item.bigImg)">
          </div>
          <div class="title df-sbc">
            <p class="line-2 ft-16 flex-1" v-html="$TOOL.getText(item.teamIntroduction)"></p>
            <div class="btn df-cc">查看详情</div>
          </div>
        </el-card>
      </li>
    </ul>
  </div>
</template>

<script setup>
import {homeApi} from "@/api";
import {useRouter} from "vue-router";
import KTabs from "@/components/k-tabs.vue";

const dataList=ref([])

const templateImg=new URL('/images/templateImg.jpg', import.meta.url).href
onMounted(loadPageData)
async function loadPageData(){
  const res=await homeApi.getTeamList.get()
  console.log(res)
  dataList.value=(res||[]).filter(v=>v.bigImg)
}

const router=useRouter()
function jumpToDetails(item){
  router.push(`/teamDetails?id=${item.id}`)
}

function errLoadImage(item){
  item.bigImg=templateImg
}
</script>

<style scoped lang="scss">
.common-content{
  background: #FFFFFF;
  padding: 30px;
  .title-mask-box{
    position: absolute;
    width: 100%;
    font-size: 26px;
    display: flex;
    align-items: center;
    padding:10px 16px;
    font-weight: bold;
    color: #FFFFFF;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 100%);
    top: 0;
    left: 0;
    z-index: 3;
  }
  .header {
    height: 80px;
    border-bottom: 1px solid #ccc;
    display: flex;
    justify-content: space-between;

    .current-box {
      display: flex;
      align-items: center;
      color: #333333;
      font-size: 16px;

      .line {
        width: 20px;
        border-bottom: 1px solid #333;
        margin: 0 5px;
      }

      .current-text {
        color: #999;
      }

      .base-text {
        color: $base-color;
      }
    }

    .title {
      position: relative;
      height: 100%;
      padding-top: 16px;
      font-size: 26px;
      font-weight: bold;
      color: $base-color;

      &::after {
        content: '';
        width: 100%;
        border-bottom: 2px solid $base-color;
        position: absolute;
        left: 0;
        bottom: 0;
      }
    }
  }
  .video-list{
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 30px;
    margin-top: 30px;
    gap: 16px;
    .video-icon{
      --size: 60px;
      --bootom: 10%;
      width: var(--size);
      height: var(--size);
      background-color: rgba(0, 0, 0, 0.65);
      position: absolute;
      right: 15px;
      bottom: var(--bootom);
      border-radius: 50%;
      z-index: 2;
      &:before{
        content: '';
        display: block;
        width: 0;
        height: 0;
        border-top: 10px solid transparent;
        border-left: 15px solid #fff;
        border-bottom: 10px solid transparent;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-48%, -50%);
      }
    }
    li{
      cursor: pointer;
      width: calc(100% / 4 - 16px );
      .btn{
        width: 64px;
        height: 24px;
        background: #F6F7F9;
        border-radius: 4px 4px 4px 4px;
        font-size: 12px;
        color: #3C8BFF;
      }
      .cover{
        width: 100%;
        overflow: hidden;
        position: relative;
        &:hover{
          img{
            transform: scale(1.05);
          }
        }
        img{
          object-fit: cover;
          aspect-ratio: 16 / 9;
          display: block;
          transition: all 0.3s ease-out;
          width: 100%;
        }
      }
      .title{
        font-size: 16px;
        padding: 16px;
      }
    }
  }
}
</style>
